﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;

namespace FM.校时
{
    public class 时间服务主机
    {

        public static ServiceHost myServiceHost = null;

        public static void 启动服务(I系统时间 instance)
        {
            //Uri baseAddress = new Uri(System.Configuration.ConfigurationSettings.AppSettings["baseAddress"]);
            Uri baseAddress = new Uri("http://localhost:8090/service");
            myServiceHost = new ServiceHost(instance, baseAddress);
            //myServiceHost = new ServiceHost(typeof(系统时间1)); 
            myServiceHost.Open();
        }

        public static void 停止服务()
        {
            if (myServiceHost.State != CommunicationState.Closed)
                myServiceHost.Close();
        }
    }
}
